#!/usr/bin/python
# -*- coding : UTF-8 -*-
# ========================
# @Time  : 2020/5/18 13:50
# @Author: Mecell
# @File  : main.py
# ========================

import os

import pytest

from common.path_constants import ALLURE_RAW

if __name__ == '__main__':

    """全量执行所有测试用例并生成allure报告和HTML报告"""
    for filename in os.listdir(ALLURE_RAW): # 执行前清空allure原生文件夹的文件，保持每次的allure报告为最新的
        file = os.path.join(ALLURE_RAW, filename)
        if os.path.exists(file) and os.path.isfile(file):
            os.remove(file)
    pytest.main(["-v", "--alluredir", "./report/allure_raw",'--reruns','2','--reruns-delay','2',"--html=report/OA3.0_TestReport.html"])
    # pytest.main(["-v", "-m","AssetStock","--alluredir", "./report/allure_raw",'--reruns','2','--reruns-delay','2',"--html=report/OA3.0_TestReport.html"])
    os.system(r"allure generate ./report/allure_raw -o ./report/allure_report -c")

    """生成allure报告"""
    #pytest.main(["-v", "--alluredir", "./report/allure_raw","-m", "OpinionClassify",'--reruns','2','--reruns-delay','2'])
    # os.system(r"allure generate ./report/allure_raw -o ./report/allure_report -c")

    """生成普通HTML报告"""
    #pytest.main(['-v','-m','OpinionInvalid','--reruns','2','--reruns-delay','2',"--html=report/OA3.0_TestReport.html"])

    """不生成报告"""

    # pytest.main(["-v", "-m", "DeleteAsset",'--reruns','2','--reruns-delay','2'])
    # pytest.main(['--reruns','2','--reruns-delay','2'])



